package com.company.yun.bean.account;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Lovelin on 2019/5/27
 * <p>
 * Describe:
 */
public class DetailLineBean {
    /**
     * data : {"ddate":["20180101","20180102","20180103","20180104","20180105","20180106","20180107","20180108","20180109","20180110","20180111","20180112","20180113","20180114","20180115","20180116","20180117","20180118","20180119","20180120","20180121","20180122","20180123","20180124","20180125","20180126","20180127","20180128","20180129","20180130","20180131","20180201","20180202","20180203","20180204","20180205","20180206","20180207","20180208","20180209","20180210","20180211","20180212","20180213","20180221","20180222","20180223","20180224","20180225","20180226","20180227","20180228","20180301","20180302","20180303","20180304","20180305","20180306","20180307","20180308","20180309","20180310","20180311","20180312","20180313","20180314","20180315","20180316","20180317","20180318","20180319","20180320","20180321","20180322","20180323","20180324","20180327","20180328","20180329","20180330","20180408","20180409","20180410","20180411","20180412","20180413","20180414","20180415","20180416","20180417","20180418","20180419","20180420","20180421","20180422","20180423","20180424","20180425","20180426","20180427","20180428","20180429","20180430","20180501","20180502","20180503","20180504","20180505","20180506","20180507","20180508","20180509","20180510","20180511","20180512","20180513","20180514","20180515","20180516","20180517","20180518","20180523","20180524","20180525","20180526","20180527","20180528","20180529","20180530","20180531"],"value":["13281.67","18556.67","25133.48","21160.47","14099.13","11669.27","14736.43","16278.75","16743.60","16518.68","17011.98","22776.21","21023.55","21690.85","21275.13","25263.98","30344.61","31822.05","27854.18","26868.17","25766.11","25596.26","23076.37","23782.15","24723.78","19989.30","20503.23","19393.05","18684.88","18904.38","17108.95","6749.13","12282.88","11606.42","11642.75","4327.61","6.63","422.89","4500.04","4186.86","9592.07","10610.31","6231.16","6264.26","5165.71","4685.71","12263.64","19721.90","24147.58","26839.79","23477.65","23763.56","27970.41","21984.31","25737.44","28690.34","29263.03","33877.36","31688.83","27448.80","30043.46","33381.99","31474.83","31850.38","24027.28","23335.73","3.26","14047.21","19562.23","7373.76","14391.86","26795.30","22933.25","26354.56","20702.97","9215.11","6444.69","21357.14","27827.80","19824.79","614.70","5224.11","2486.66","2378.07","31.70","68.66","148.42","1099.37","1630.92","1046.52","1484.22","2311.55","1972.23","2183.43","2029.81","1314.19","461.85","1477.25","1967.20","1479.11","975.05","1118.67","1764.10","5601.93","13987.10","9479.53","8628.36","7923.11","9440.73","7951.93","4804.73","3388.78","1217.21","1586.14","1347.87","428.92","1205.41","3215.54","3572.18","3187.23","122.04","32.84","412.57","670.45","2111.75","2148.31","2019.05","2551.05","2125.65","2581.82"]}
     * status : 0
     * info :
     */
    private DataEntity data;
    private String status;
    private String info;


    public void getAllData(String response) {
        try {
            JSONObject object = new JSONObject(response);
            setStatus(object.getString("status"));
            setInfo(object.getString("info"));
            JSONObject data = object.getJSONObject("data");
            DataEntity dataEntity = new DataEntity();
            dataEntity.getData(data);
            setData(dataEntity);


        } catch (JSONException e) {

        }
    }

    public void setData(DataEntity data) {
        this.data = data;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public DataEntity getData() {
        return data;
    }

    public String getStatus() {
        return status;
    }

    public String getInfo() {
        return info;
    }

    public class DataEntity {
        /**
         * ddate : ["20180101","20180102","20180103","20180104","20180105","20180106","20180107","20180108","20180109","20180110","20180111","20180112","20180113","20180114","20180115","20180116","20180117","20180118","20180119","20180120","20180121","20180122","20180123","20180124","20180125","20180126","20180127","20180128","20180129","20180130","20180131","20180201","20180202","20180203","20180204","20180205","20180206","20180207","20180208","20180209","20180210","20180211","20180212","20180213","20180221","20180222","20180223","20180224","20180225","20180226","20180227","20180228","20180301","20180302","20180303","20180304","20180305","20180306","20180307","20180308","20180309","20180310","20180311","20180312","20180313","20180314","20180315","20180316","20180317","20180318","20180319","20180320","20180321","20180322","20180323","20180324","20180327","20180328","20180329","20180330","20180408","20180409","20180410","20180411","20180412","20180413","20180414","20180415","20180416","20180417","20180418","20180419","20180420","20180421","20180422","20180423","20180424","20180425","20180426","20180427","20180428","20180429","20180430","20180501","20180502","20180503","20180504","20180505","20180506","20180507","20180508","20180509","20180510","20180511","20180512","20180513","20180514","20180515","20180516","20180517","20180518","20180523","20180524","20180525","20180526","20180527","20180528","20180529","20180530","20180531"]
         * value : ["13281.67","18556.67","25133.48","21160.47","14099.13","11669.27","14736.43","16278.75","16743.60","16518.68","17011.98","22776.21","21023.55","21690.85","21275.13","25263.98","30344.61","31822.05","27854.18","26868.17","25766.11","25596.26","23076.37","23782.15","24723.78","19989.30","20503.23","19393.05","18684.88","18904.38","17108.95","6749.13","12282.88","11606.42","11642.75","4327.61","6.63","422.89","4500.04","4186.86","9592.07","10610.31","6231.16","6264.26","5165.71","4685.71","12263.64","19721.90","24147.58","26839.79","23477.65","23763.56","27970.41","21984.31","25737.44","28690.34","29263.03","33877.36","31688.83","27448.80","30043.46","33381.99","31474.83","31850.38","24027.28","23335.73","3.26","14047.21","19562.23","7373.76","14391.86","26795.30","22933.25","26354.56","20702.97","9215.11","6444.69","21357.14","27827.80","19824.79","614.70","5224.11","2486.66","2378.07","31.70","68.66","148.42","1099.37","1630.92","1046.52","1484.22","2311.55","1972.23","2183.43","2029.81","1314.19","461.85","1477.25","1967.20","1479.11","975.05","1118.67","1764.10","5601.93","13987.10","9479.53","8628.36","7923.11","9440.73","7951.93","4804.73","3388.78","1217.21","1586.14","1347.87","428.92","1205.41","3215.54","3572.18","3187.23","122.04","32.84","412.57","670.45","2111.75","2148.31","2019.05","2551.05","2125.65","2581.82"]
         */
        private List<String> ddate;
        private List<String> value;

        public void getData(JSONObject data) {
            try {

                ArrayList<String> ddateList = new ArrayList<>();
                ArrayList<String> valueList = new ArrayList<>();
                JSONArray ddate = data.getJSONArray("ddate");
                JSONArray value = data.getJSONArray("value");
                for (int i = 0; i < ddate.length(); i++) {
                    ddateList.add((String) ddate.get(i));
                    setDdate(ddateList);
                }
                for (int i = 0; i < value.length(); i++) {
                    valueList.add((String) value.get(i));
                    setValue(valueList);
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }


        }

        public void setDdate(List<String> ddate) {
            this.ddate = ddate;
        }

        public void setValue(List<String> value) {
            this.value = value;
        }

        public List<String> getDdate() {
            return ddate;
        }

        public List<String> getValue() {
            return value;
        }


    }
}
